package chz.emarket.dao;

import java.util.List;

import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;

import chz.emarket.model.Content;

public interface ContentDao {
	
	@Results({ 
	@Result(property = "id", column = "id"), 
	@Result(property = "price", column = "price"),
	@Result(property = "title", column = "title"),
	@Result(property = "icon", column = "icon"),
	@Result(property = "abstr", column = "abstract"),
	@Result(property = "text", column = "text")}
)
	@Select("SELECT * FROM content where id=#{id}")
	public Content getContentById(Integer id);
	
	@Results({ 
	@Result(property = "id", column = "id"), 
	@Result(property = "price", column = "price"),
	@Result(property = "title", column = "title"),
	@Result(property = "icon", column = "icon"),
	@Result(property = "abstr", column = "abstract"),
	@Result(property = "text", column = "text")}
)
	@Select("SELECT * FROM content")
	public List<Content> getContentList();
	
	@Insert("insert into content (price,title,icon,abstract,text) values (#{price}, #{title}, #{icon}, #{abstract}, #{text})")
	public void addContent(Content content);
	
	
}
